package com.thwj.project.biz.enums;

/***
 * 消息类型
 */
public enum MessageTypeEnum {

    SYSTEM_MESSAGE(100,"系统消息", MessageBelongTypeEnum.SYSTEM_MESSAGE,null),
    USER_AUTHENTICATION_AUDIT_MESSAGE(101,"认证审核消息", MessageBelongTypeEnum.SYSTEM_MESSAGE, BannerActionTypeEnum.path),
    MERCHANT_AUDIT_MESSAGE(102,"场地审核消息", MessageBelongTypeEnum.SYSTEM_MESSAGE, BannerActionTypeEnum.path),
    ACTIVITY_MESSAGE(103,"活动消息", MessageBelongTypeEnum.SYSTEM_MESSAGE, BannerActionTypeEnum.path),


    DYNAMICS_MESSAGE(200,"动态消息",MessageBelongTypeEnum.DYNAMICS_MESSAGE, BannerActionTypeEnum.path),
    ATTENTION_MESSAGE(201,"关注消息",MessageBelongTypeEnum.DYNAMICS_MESSAGE, BannerActionTypeEnum.path),



    DIDI_MESSAGE(300,"滴滴消息",MessageBelongTypeEnum.DIDI_MESSAGE, BannerActionTypeEnum.path),
    ;
    MessageTypeEnum(int value, String name, MessageBelongTypeEnum belongTypeEnum, BannerActionTypeEnum actionTypeEnum) {
        this.name = name;
        this.value = value;
        this.belongTypeEnum = belongTypeEnum;
        this.actionTypeEnum = actionTypeEnum;
    }

    private int value;
    private String name;
    private MessageBelongTypeEnum belongTypeEnum;
    private BannerActionTypeEnum actionTypeEnum;

    private String pathTemplate;

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public MessageBelongTypeEnum getBelongTypeEnum() {
        return belongTypeEnum;
    }

    public BannerActionTypeEnum getActionTypeEnum() {
        return actionTypeEnum;
    }

    public static MessageTypeEnum getEnumByValue(Integer value){
        for (MessageTypeEnum typeEnum : MessageTypeEnum.values()) {
            if(typeEnum.value == value) {
                return typeEnum;
            }
        }
        return null;
    }

    public static String getPath(MessageTypeEnum messageTypeEnum ,Long objectId) {
        String path = null;
        switch (messageTypeEnum) {
            case DIDI_MESSAGE:
            case SYSTEM_MESSAGE:
                break;
            case ACTIVITY_MESSAGE:
                path = "/pages/detail/detail?activityId=" + objectId;
                break;
            case DYNAMICS_MESSAGE:
                path = "/pages/commit-detail/commit-detail?id=" + objectId;
                break;
            case ATTENTION_MESSAGE:
                path = "/pages/personal/personal?userId=" + objectId;
                break;
        }
        return path;
    }
}
